<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>不挂高数管理页-控制</title>
    <!-- Favicon -->
    <link rel="shortcut icon" href="/favicon.png"/>
    <link rel="bookmark" href="/favicon.png"/>
    <!-- Icons -->
    <link href="/assets/vendor/nucleo/css/nucleo.css" rel="stylesheet">
    <link href="/assets/vendor/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet">
    <!-- Argon CSS -->
    <link type="text/css" href="/assets/css/argon.css?v=1.0.0" rel="stylesheet">
    <style type="text/css">

    </style>
    <script src="/js/jquery-3.4.1.min.js"></script>
</head>

<body>
<!-- Sidenav -->

<nav class="navbar navbar-vertical fixed-left navbar-expand-md navbar-light bg-white" id="sidenav-main">
    <div class="container-fluid">
        <!-- Toggler -->
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#sidenav-collapse-main" aria-controls="sidenav-main" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <!-- Brand -->
        <a class="navbar-brand pt-0" href="/admin/main">
            <img src="/favicon.png" class="navbar-brand-img" alt="不挂高数社区">
            不挂高数社区
        </a>
        <!-- User -->
        <ul class="nav align-items-center d-md-none">
            <li class="nav-item dropdown">
                <a class="nav-link" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    <div class="media align-items-center">
              <span class="avatar avatar-sm rounded-circle">
                <img alt="用户头像" th:src="${session.admin.getHeadUrl()}">
              </span>
                    </div>
                </a>
                <div class="dropdown-menu dropdown-menu-arrow dropdown-menu-right">
                    <div class=" dropdown-header noti-title">
                        <h6 id="welcome-text-1" class="text-overflow m-0">Welcome!</h6>
                    </div>

                    <div class="dropdown-divider"></div>
                    <a href="/admin/signOut" class="dropdown-item">
                        <i class="ni ni-user-run"></i>
                        <span>退出</span>
                    </a>
                </div>
            </li>
        </ul>
        <!-- Collapse -->
        <div class="collapse navbar-collapse" id="sidenav-collapse-main">
            <!-- Collapse header -->
            <div class="navbar-collapse-header d-md-none">
                <div class="row">
                    <div class="col-6 collapse-brand">
                        <a href="/admin/main">
                            <img src="/favicon.png">
                        </a>
                        不挂高数社区
                    </div>
                    <div class="col-6 collapse-close">
                        <button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#sidenav-collapse-main" aria-controls="sidenav-main" aria-expanded="false" aria-label="Toggle sidenav">
                            <span></span>
                            <span></span>
                        </button>
                    </div>
                </div>
            </div>
            <!-- Form -->
            <form class="mt-4 mb-3 d-md-none" action="/admin/search" method="get">
                <div class="input-group input-group-rounded input-group-merge">
                    <input name="search" type="search" class="form-control form-control-rounded form-control-prepended" placeholder="搜索用户或问题" aria-label="Search">
                    <div class="input-group-prepend">
                        <div class="input-group-text">
                            <span class="fa fa-search"></span>
                        </div>
                    </div>
                </div>
            </form>
            <!-- Navigation -->
            <ul class="navbar-nav">
                <li class="nav-item">
                    <a class="nav-link" href="/admin/main">
                        <i class="ni ni-tv-2 text-primary"></i> 主页
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/admin/question">
                        <i class="ni ni-bullet-list-67 text-red"></i> 问题信息
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/admin/user">
                        <i class="ni ni-single-02 text-yellow"></i> 用户信息
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/admin/search">
                        <i class="ni ni-planet text-blue"></i> 搜索
                    </a>
                </li>
                <li class="nav-item active">
                    <a class="nav-link" href="/admin/controller">
                        <i class="ni ni-key-25 text-info"></i> 社区设置
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/admin/advertisement">
                        <i class="ni ni-bullet-list-67 text-red"></i> 广告和新闻设置
                    </a>
                </li>
            </ul>
            <!-- Divider -->
            <hr class="my-3">
            <!-- Heading -->



        </div>
    </div>
</nav>
<!-- Main content -->
<div class="main-content">
    <!-- Top navbar -->
    <nav class="navbar navbar-top navbar-expand-md navbar-dark" id="navbar-main">
        <div class="container-fluid">
            <!-- Brand -->
            <a class="h4 mb-0 text-white text-uppercase d-none d-lg-inline-block" href="#">控制面板</a>
            <!-- Form -->
            <form class="navbar-search navbar-search-dark form-inline mr-3 d-none d-md-flex ml-lg-auto" action="/admin/search" method="get">
                <div class="form-group mb-0">
                    <div class="input-group input-group-alternative">
                        <div class="input-group-prepend">
                            <span class="input-group-text"><i class="fas fa-search"></i></span>
                        </div>
                        <input name="search" class="form-control" placeholder="搜索用户或问题" type="text">
                    </div>
                </div>
            </form>
            <!-- User -->
            <ul class="navbar-nav align-items-center d-none d-md-flex">
                <li class="nav-item dropdown">
                    <a class="nav-link pr-0" href="#" role="button" data-toggle="dropdown" aria-haspopup="true"
                       aria-expanded="false">
                        <div class="media align-items-center">
                <span class="avatar avatar-sm rounded-circle">
                  <img alt="管理员头像" th:src="${session.admin.getHeadUrl()}">
                </span>
                            <div class="media-body ml-2 d-none d-lg-block">
                                <span class="mb-0 text-sm  font-weight-bold" id="right_top_name" th:text="${session.admin.getUserName()}"></span>
                            </div>
                        </div>
                    </a>
                    <div class="dropdown-menu dropdown-menu-arrow dropdown-menu-right">
                        <div class=" dropdown-header noti-title">
                            <h6 id="welcome-text-2" class="text-overflow m-0">Welcome!</h6>
                        </div>


                        <div class="dropdown-divider" id="logout"></div>
                        <a href="/admin/signOut" class="dropdown-item">
                            <i class="ni ni-user-run"></i>
                            <span>退出</span>
                        </a>
                    </div>
                </li>
            </ul>
        </div>
    </nav>
    <!-- Header -->
    <div class="header bg-gradient-primary pb-8 pt-5 pt-md-8">
        <div class="container-fluid">
            <div class="header-body">
                <!-- Card stats -->

            </div>
        </div>
    </div>
    <!-- Page content -->
    <div class="container-fluid mt--7" >
        <!-- Table -->
        <div class="row">
            <div class="col">
                <div class="card shadow">
                    <div class="card-header border-0">
                        <h3 class="mb-0">控制面板</h3>
                    </div>
                    <ul class="nav nav-pills mb-3 ml-3" id="pills-tab" role="tablist">
                        <li class="nav-item">
                            <a class="nav-link active" id="pills-home-tab" data-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true">
                                设置首页问题置顶
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false">
                                系统设置
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" id="pills-contact-tab" data-toggle="pill" href="#pills-contact" role="tab" aria-controls="pills-contact" aria-selected="false">
                                其他设置
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" id="pills-log-tab" data-toggle="pill" href="#pills-log" role="tab" aria-controls="pills-log" aria-selected="false">
                                日志下载
                            </a>
                        </li>
                    </ul>
                    <hr/>
                    <div class="tab-content" id="pills-tabContent">
<!--                        置顶问题-->
                        <div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab">
                            <div class="row">
                                <div class="col">
                                    <h4 class="ml-3">说明：</h4>
                                    <h5 class="ml-3">
                                        最多可设置三个置顶问题，将问题ID输入到右边输入框点确认即可。
                                        <br/>
                                        如果不需要设置那么多的置顶问题，将输入框留空即可。
                                        <br/>
                                        如果要取消全部置顶，则请在右边输入框中将所有数字填 0 后点确定即可！
                                    </h5>
                                </div>
                                <div class="col-8">
                                    <div class="container w-75">
                                        <div class="form-group mb-3">
                                            <div class="input-group input-group-alternative">
                                                <div class="input-group-prepend">

                                                </div>
                                                <input class="form-control" id="question-Id-1" placeholder="置顶问题1的问题ID" type="number">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="input-group input-group-alternative">
                                                <div class="input-group-prepend">

                                                </div>
                                                <input class="form-control" id="question-Id-2" placeholder="置顶问题2的问题ID" type="number">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="input-group input-group-alternative">
                                                <div class="input-group-prepend">
                                                </div>
                                                <input class="form-control" id="question-Id-3" placeholder="置顶问题2的问题ID" type="number">
                                            </div>
                                        </div>
                                        <div id="question-id-warning" class="alert alert-warning" role="alert" style="display: none;">

                                        </div>
                                        <div class="text-center">
                                            <button type="button" class="btn btn-primary my-4" onclick="settingIndexTopQuestion()">确认设置</button>
                                        </div>
                                    </div>
                                </div>
                            </div>


                        </div>
<!--                        系统设置-->
                        <div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab">
                            即将上线
                        </div>
<!--                        其它设置-->
                        <div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab">
                            <div class="row ml-2">
                                <button type="button" class="btn btn-primary" onclick="updateHotUser()">立即重新计算热门用户</button>
                                <button type="button" class="btn btn-primary" onclick="updateHotTag()">立即重新计算热门标签</button>
                                <button type="button" class="btn btn-primary" onclick="updateHotQuestion()">立即重新计算热门问题</button>
                                <button type="button" class="btn btn-primary" onclick="updateTagClass()">立即同步话题页</button>
                            </div>
                            <div class="container" style="height: 30px">

                            </div>
                        </div>
                        <!--                        日志下载-->
                        <div class="tab-pane fade" id="pills-log" role="tabpanel" aria-labelledby="pills-log-tab">
                            <div class="container">
                                <h5>注意：最新日志不可删除，只能查看下载，历史日志可以删除下载，但不能在线查看！</h5>
                            </div>
                            <div class="table-responsive" id="classTable">
                                <table class="table align-items-center table-flush">
                                    <thead class="thead-light">
                                    <tr>
                                        <th scope="col">日志名</th>
                                        <th scope="col">时间</th>
                                        <th scope="col">查看</th>
                                        <th scope="col">下载</th>
                                        <th scope="col">删除</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr th:each="log : ${logs}">
                                        <th scope="row" th:text="${log.getTitle()}">
                                            spring.log
                                        </th>
                                        <td th:text="${log.getTime()}">
                                            时间
                                        </td>
                                        <td>
                                            <span th:if="${log.getShow()}">
                                                <a class="btn btn-primary btn-sm" target="_blank" th:href="${'/admin/log/download/' + log.getUrl() + '?type=show'}">查看</a>
                                            </span>
                                            <span th:if="${log.getShow()==false}"></span>
                                        </td>

                                        <td>
                                            <a class="btn btn-success btn-sm" target="_blank" th:href="${'/admin/log/download/' + log.getUrl() + '?type=download'}"> <span>下载</span></a>
                                        </td>
                                        <td>
                                            <button type="button" class="btn btn-danger btn-sm" th:if="${log.getShow()==false}" th:data-title="${log.getTitle()}" onclick="setLogTitle(this)">删除</button>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div class="container" style="height: 30px">

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>



        <!-- Footer  -->
        <footer class="footer">
            <div class="row align-items-center justify-content-xl-between">
                <div class="col-xl-6">
                    <div class="copyright text-center text-xl-left text-muted">
                        &copy; 2019 <a href="/" class="font-weight-bold ml-1"
                                      >不挂高数社区</a>
                    </div>
                </div>
                <div class="col-xl-6">
                    <ul class="nav nav-footer justify-content-center justify-content-xl-end">
                        <li class="nav-item">
                            <a href="#" class="nav-link" target="_blank"></a>
                        </li>
                        <li class="nav-item">
                            <a href="#" class="nav-link"></a>
                        </li>

                        <li class="nav-item">
                            <a href="#"
                               class="nav-link" target="_blank"></a>
                        </li>
                    </ul>
                </div>
            </div>
        </footer>

    </div>
</div>
<!-- Argon Scripts -->
<!-- Core -->
<div id="showSendDeleteLog"  style="width: 100%; height: 100%;position:fixed;bottom: 0px;background: rgba(0, 0, 0, 0.7);display: none">
    <div class="container" style="height: 60px"></div>
    <div class="container">
        <input type="hidden" id="fileName" value="-1">
        <div class="form-group">
            <label style="color:white;" for="password">敏感操作，请输入密码验证：</label>
            <input autocomplete="off" type="password" name="password" class="form-control" id="password"
                   aria-describedby="timeHelp" placeholder="请输入密码">
            <small id="passwordHelp" class="form-text text-muted"></small>
        </div>
        <div class="container" style="height: 30px"></div>
        <p style="color: white" id="result"></p>
        <div class="container" style="height: 30px"></div>
        <button type="button"  class="btn btn-primary" onclick="sendDeleteLog()">提交</button>
        <button type="button"  class="btn btn-secondary" onclick="closeDeleteLog()">取消</button>
    </div>
</div>
<script src="/assets/vendor/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<!-- Argon JS -->
<script src="/assets/js/argon.js?v=1.0.0"></script>
<script src="/js/admin.js"></script>

</body>

</html>